package com.lucenten.collect.gnss.handler.tools;


/**
 * 重命名工具类
 *
 * @author July july_sky@foxmail.com
 * @version 1.0
 * @date 2019/4/28 23:27
 * @Copyright 东方浩星（北京）传媒科技有限公司版权所有.All Rights Reserved.
 */
public class ReNameTools {
    private final static String[] RANDOM_SEED = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "l", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

    /**
     * 获取新名称
     *
     * @param num
     * @return
     * @author July july_sky@foxmail.com
     * @date 2019/4/28 23:41
     */
    public static String getReName(Integer num) {
        if (num > 26 * 999) {
            return num.toString();
        }

        int chIndex = num < 1000 ? 0 : (num % 999 == 0 ? num / 999 - 1 : num / 999);
        int mod = Math.abs(chIndex * 999 - num);
        return RANDOM_SEED[chIndex] + (mod < 10 ? "00" : mod < 100 ? "0" : "")+ mod;
    }
}
